package cn.com.callback

import groovy.json.*;
import groovy.swing.impl.DefaultAction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.RequestDispatcher;
import cn.com.elite.EliteBean;
import java.security.MessageDigest;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.wisdge.dataservice.Result;
import java.util.Map;
import java.util.Date;
import java.util.HashMap;
import cn.com.elite.Util;
import cn.com.kh.UcisXML;
import java.net.URLEncoder;

import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;

/**
 *
 * @Title: SwlgAgentStatusDetail
 * @Description:数据分离每天定时插入数据
 * @author: Yuchieh 
 * @date 2021-07-23
 *
 */


public class SwlgAgentStatusDetail implements ServiceBackInvoke{
	private static final Log log=LogFactory.getLog(SwlgAgentStatusDetail.class);
	public String doCallBack(EliteBean eliteBean,HttpServletRequest request,HttpServletResponse response){
				
		response.setCharacterEncoding("UTF-8");
		JSONObject resulterror = new JSONObject();
				

		try{
			//将数据写进his表
			//def todaysql_bak = "INSERT INTO bigdateStaff_his SELECT *,GETDATE() FROM bigdateStaff";
			//eliteBean.update(todaysql_bak, "dataSource");
			//清空表数据
			//def todaysql_del = "TRUNCATE TABLE bigdateStaff";
			//eliteBean.update(todaysql_del, "dataSource");
			//写入数据
			//--龙岗坐席信息列表
			def todaysql_ins1 = "INSERT INTO sw_lg_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0002','LGGLZ1') AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins1, "dataSource");
			//--龙岗单一通话信息 
		    def todaysql_ins2 = "INSERT INTO sw_lg_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.areatype='95ED5385-7379-1041-919A-BDF10A1CB5DC' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins2, "dataSource");
			//--龙岗核心数据 
		    def todaysql_ins3 = "INSERT INTO [sw_lg_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID]) select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID, a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0002','LGGLZ1') AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins3, "dataSource");
			//--龙岗来访公告记录 
		    def todaysql_ins4 = "INSERT INTO [sw_lg_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%龙岗%' and CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins4, "dataSource");
			//--龙岗录音记录
		    def todaysql_ins5 = "INSERT INTO [sw_lg_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID])select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID in('CW0002','LGGLZ1') and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins5, "dataSource");
			//--龙岗话务员档案 
		    def todaysql_ins6 = "INSERT INTO [sw_lg_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR]) select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP in('CW0002','LGGLZ1') and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins6, "dataSource");
			//--龙岗话务员登录信息 
		    def todaysql_ins7 = "INSERT INTO [sw_lg_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS]) select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup in('CW0002','LGGLZ1') and  LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins7, "dataSource");
			//--龙岗小结数据 
		    def todaysql_ins8 = "INSERT INTO [sw_lg_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) select createdate,phone,usercode,wateraddress,phonetype,phonetype1,phoneremark from TABCsummarize where region='龙岗区' and createdate<CONVERT(VARCHAR(10),GETDATE(),120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins8, "dataSource");
			//--龙岗工单数据 
		    def todaysql_ins17 = "INSERT INTO [sw_lg_work] ([RELATION_ID], [workorderid], [usercode], [linkname], [userphone], [username], [usermobile], [keyword], [ywlyCode_Name], [mglxCode_Name], [Area_desc], [rangecodedepart], [organization], [wateraddress], [street], [problemdescription], [opinion], [isnoresolve], [emergencyrepair], [isovertime], [isdoortodoor], [datelimit], [rangecodemobile], [isvalidity], [isautoreturnvisit], [staffid], [staffname], [registrant], [registrantname], [registerdate], [ordertime], [workorderreceiver], [receivername], [c1Code_Name], [c2Code_Name], [c3Code_Name], [leakagecondition], [handledescription], [remarks], [failurecause], [starttime], [finishtime], [workingday], [handlerby], [handlername], [handlerphone], [responsibleperson], [responsiblename], [arriveddate], [firstarrivaldate], [checkgrade], [registercode], [registercodename], [requestdate], [doordate], [userreflect], [serviceattitude], [quality], [returnpeople], [returnname], [feedbacktime], [mydCode_NAME], [ZZDCode_Name], [feedback], [codeCode_Name]) SELECT distinct t1.RELATION_ID ,t1.workorderid ,t1.usercode ,t1.linkname  ,t1.userphone  ,t1.username  ,t1.usermobile  ,t1.keyword  ,ywly.Code_Name ,mglx.Code_Name  ,ga.Area_desc  ,t1.rangecodedepart  ,t1.organization  ,t1.wateraddress  ,t1.street  ,t1.problemdescription  ,t1.opinion  ,(CASE t1.isnoresolve WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.emergencyrepair WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isovertime WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isdoortodoor WHEN '0' THEN '否' ELSE '是' END ),t1.datelimit ,t1.rangecodemobile ,(CASE t1.isvalidity WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isautoreturnvisit WHEN '0' THEN '否' ELSE '是' END ) ,t1.staffid ,t1.staffname ,t1.registrant ,t1.registrantname ,t1.registerdate ,t1.ordertime ,t1.workorderreceiver ,t1.receivername ,c1.Code_Name ,c2.Code_Name ,c3.Code_Name ,t1.leakagecondition ,t1.handledescription ,t1.remarks ,t1.failurecause ,t1.starttime ,t1.finishtime ,t1.workingday ,t1.handlerby ,t1.handlername ,t1.handlerphone ,t1.responsibleperson ,t1.responsiblename ,t1.arriveddate,t1.firstarrivaldate ,t1.checkgrade ,t1.registercode ,t1.registercodename ,t1.requestdate ,t1.doordate ,(CASE t1.userreflect WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.serviceattitude WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.quality WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ),t1.returnpeople ,t1.returnname ,t1.feedbacktime ,myd.Code_NAME ,ZZD.Code_Name  ,t1.feedback ,code.Code_Name FROM  objective o LEFT JOIN WO3_FRAME_MAP fm on fm.map_id=o.map_id LEFT JOIN WO3_node_MAP nm on o.CURSTEP_ID_MAP=nm.nodemap_id and nm.MAP_ID=fm.map_id LEFT JOIN Customer  C ON o.Customer_GUID = C.Customer_GUID LEFT JOIN sysc_priority On o.Priority_id=sysc_priority.Priority_ID LEFT JOIN ROLEGROUP R1 ON R1.ROLEGROUP_ID=o.HandleGroup_ID LEFT JOIN STAFF S1 ON S1.STAFF_ID=o.HandleBy_ID LEFT JOIN STAFF S2 ON S2.STAFF_ID=o.ModifiedBy LEFT JOIN STAFFROLEGROUP SR ON SR.STAFF_ID=S1.STAFF_ID LEFT JOIN sysc_objectivestatus so on o.objectivestatus=so.objectivestatus LEFT JOIN role role on o.handlerole_id=role.role_id  LEFT JOIN TABCswgdmerge t1 on o.objective_guid=t1.relation_id left join C_CodeTables code on  t1.workorderstatus=code.Code_ID and use_type='工单状态' left join C_CodeTables c1 on  t1.registerbusiness1=c1.Code_ID and c1.use_type='一级业务类型' left join C_CodeTables c2 on  t1.registerbusiness2=c2.Code_ID and c2.use_type='二级业务类型' left join C_CodeTables c3 on  t1.registerbusiness3=c3.Code_ID and c3.use_type='三级业务类型' left join C_CodeTables cc on  t1.rangecodewater=cc.Code_ID and cc.use_type='受理部门' left join C_CodeTables ywly on  t1.operationsource=ywly.Code_ID and ywly.use_type='业务来源' left join C_CodeTables mglx on  t1.sensitive=mglx.Code_ID and mglx.use_type='敏感类型' left join C_CodeTables myd on  t1.satisfaction=myd.Code_ID and myd.use_type='满意度' left join C_CodeTables zzd on  t1.empattire=zzd.Code_ID and zzd.use_type='满意度' left join Group_Area ga on  t1.RECEIVER=ga.area_id where 1=1   and fm.map_id='ZHS14C' and t1.receiver='LG' and  t1.registerdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)  and  o.createddate>CONVERT(VARCHAR(10),GETDATE()-1,120) and  t1.registerdate<CONVERT(VARCHAR(10),GETDATE(),120)  and  o.createddate<CONVERT(VARCHAR(10),GETDATE(),120) order by  t1.registerdate desc ";
			eliteBean.update(todaysql_ins17, "dataSource");
			
			//--龙华坐席信息列表
			def todaysql_ins9 = "INSERT INTO sw_lh_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID  LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('BASS05','70RGXY') AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins9, "dataSource");
			//--龙华单一通话信息 
		    def todaysql_ins10 = "INSERT INTO sw_lh_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select  c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.flowid='龙华流程' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120) UNION select  c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.flowid='转接'and s.nodeid='LH' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins10, "dataSource");
			//--龙华核心数据 
		    def todaysql_ins11 = "INSERT INTO [sw_lh_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID])select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID,a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('BASS05','70RGXY') AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins11, "dataSource");
			//--龙华来访公告记录 
		    def todaysql_ins12 = "INSERT INTO [sw_lh_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%龙华%' and  CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins12, "dataSource");
			//--龙华录音记录
		    def todaysql_ins13 = "INSERT INTO [sw_lh_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID]) select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID in('BASS05','70RGXY') and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins13, "dataSource");
			//--龙华话务员档案 
		    def todaysql_ins14 = "INSERT INTO [sw_lh_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR])select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP in('BASS05','70RGXY') and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins14, "dataSource");
			//--龙华话务员登录信息 
		    def todaysql_ins15 = "INSERT INTO [sw_lh_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS])select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup in('BASS05','70RGXY') and LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins15, "dataSource");
			//--龙华小结数据 
		    def todaysql_ins16 = "INSERT INTO [sw_lh_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) select createdate,phone,usercode,wateraddress,phonetype,phonetype1,phoneremark from TABCsummarize where region='龙华区' and createdate<CONVERT(VARCHAR(10),GETDATE(),120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins16, "dataSource");
			
			//--集团工单数据 
		    def todaysql_ins18 = "INSERT INTO [sw_jt_work] ([RELATION_ID], [workorderid], [usercode], [linkname], [userphone], [username], [usermobile], [keyword], [ywlyCode_Name], [mglxCode_Name], [Area_desc], [rangecodedepart], [organization], [wateraddress], [street], [problemdescription], [opinion], [isnoresolve], [emergencyrepair], [isovertime], [isdoortodoor], [datelimit], [rangecodemobile], [isvalidity], [isautoreturnvisit], [staffid], [staffname], [registrant], [registrantname], [registerdate], [ordertime], [workorderreceiver], [receivername], [c1Code_Name], [c2Code_Name], [c3Code_Name], [leakagecondition], [handledescription], [remarks], [failurecause], [starttime], [finishtime], [workingday], [handlerby], [handlername], [handlerphone], [responsibleperson], [responsiblename], [arriveddate], [firstarrivaldate], [checkgrade], [registercode], [registercodename], [requestdate], [doordate], [userreflect], [serviceattitude], [quality], [returnpeople], [returnname], [feedbacktime], [mydCode_NAME], [ZZDCode_Name], [feedback], [codeCode_Name]) SELECT distinct t1.RELATION_ID ,t1.workorderid ,t1.usercode ,t1.linkname  ,t1.userphone  ,t1.username  ,t1.usermobile  ,t1.keyword  ,ywly.Code_Name ,mglx.Code_Name  ,ga.Area_desc  ,t1.rangecodedepart  ,t1.organization  ,t1.wateraddress  ,t1.street  ,t1.problemdescription  ,t1.opinion  ,(CASE t1.isnoresolve WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.emergencyrepair WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isovertime WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isdoortodoor WHEN '0' THEN '否' ELSE '是' END ),t1.datelimit ,t1.rangecodemobile ,(CASE t1.isvalidity WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isautoreturnvisit WHEN '0' THEN '否' ELSE '是' END ) ,t1.staffid ,t1.staffname ,t1.registrant ,t1.registrantname ,t1.registerdate ,t1.ordertime ,t1.workorderreceiver ,t1.receivername ,c1.Code_Name ,c2.Code_Name ,c3.Code_Name ,t1.leakagecondition ,t1.handledescription ,t1.remarks ,t1.failurecause ,t1.starttime ,t1.finishtime ,t1.workingday ,t1.handlerby ,t1.handlername ,t1.handlerphone ,t1.responsibleperson ,t1.responsiblename ,t1.arriveddate,t1.firstarrivaldate ,t1.checkgrade ,t1.registercode ,t1.registercodename ,t1.requestdate ,t1.doordate ,(CASE t1.userreflect WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.serviceattitude WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.quality WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ),t1.returnpeople ,t1.returnname ,t1.feedbacktime ,myd.Code_NAME ,ZZD.Code_Name  ,t1.feedback ,code.Code_Name FROM  objective o LEFT JOIN WO3_FRAME_MAP fm on fm.map_id=o.map_id LEFT JOIN WO3_node_MAP nm on o.CURSTEP_ID_MAP=nm.nodemap_id and nm.MAP_ID=fm.map_id LEFT JOIN Customer  C ON o.Customer_GUID = C.Customer_GUID LEFT JOIN sysc_priority On o.Priority_id=sysc_priority.Priority_ID LEFT JOIN ROLEGROUP R1 ON R1.ROLEGROUP_ID=o.HandleGroup_ID LEFT JOIN STAFF S1 ON S1.STAFF_ID=o.HandleBy_ID LEFT JOIN STAFF S2 ON S2.STAFF_ID=o.ModifiedBy LEFT JOIN STAFFROLEGROUP SR ON SR.STAFF_ID=S1.STAFF_ID LEFT JOIN sysc_objectivestatus so on o.objectivestatus=so.objectivestatus LEFT JOIN role role on o.handlerole_id=role.role_id  LEFT JOIN TABCswgdmerge t1 on o.objective_guid=t1.relation_id left join C_CodeTables code on  t1.workorderstatus=code.Code_ID and use_type='工单状态' left join C_CodeTables c1 on  t1.registerbusiness1=c1.Code_ID and c1.use_type='一级业务类型' left join C_CodeTables c2 on  t1.registerbusiness2=c2.Code_ID and c2.use_type='二级业务类型' left join C_CodeTables c3 on  t1.registerbusiness3=c3.Code_ID and c3.use_type='三级业务类型' left join C_CodeTables cc on  t1.rangecodewater=cc.Code_ID and cc.use_type='受理部门' left join C_CodeTables ywly on  t1.operationsource=ywly.Code_ID and ywly.use_type='业务来源' left join C_CodeTables mglx on  t1.sensitive=mglx.Code_ID and mglx.use_type='敏感类型' left join C_CodeTables myd on  t1.satisfaction=myd.Code_ID and myd.use_type='满意度' left join C_CodeTables zzd on  t1.empattire=zzd.Code_ID and zzd.use_type='满意度' left join Group_Area ga on  t1.RECEIVER=ga.area_id where 1=1   and fm.map_id='ZHS14C' and t1.receiver='JT' and  t1.registerdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)  and  o.createddate>CONVERT(VARCHAR(10),GETDATE()-1,120) and  t1.registerdate<CONVERT(VARCHAR(10),GETDATE(),120)  and  o.createddate<CONVERT(VARCHAR(10),GETDATE(),120) order by  t1.registerdate desc ";
			eliteBean.update(todaysql_ins18, "dataSource");
			
			//--宝安工单数据 
		    def todaysql_ins19 = "INSERT INTO [sw_ba_work] ([RELATION_ID], [workorderid], [usercode], [linkname], [userphone], [username], [usermobile], [keyword], [ywlyCode_Name], [mglxCode_Name], [Area_desc], [rangecodedepart], [organization], [wateraddress], [street], [problemdescription], [opinion], [isnoresolve], [emergencyrepair], [isovertime], [isdoortodoor], [datelimit], [rangecodemobile], [isvalidity], [isautoreturnvisit], [staffid], [staffname], [registrant], [registrantname], [registerdate], [ordertime], [workorderreceiver], [receivername], [c1Code_Name], [c2Code_Name], [c3Code_Name], [leakagecondition], [handledescription], [remarks], [failurecause], [starttime], [finishtime], [workingday], [handlerby], [handlername], [handlerphone], [responsibleperson], [responsiblename], [arriveddate], [firstarrivaldate], [checkgrade], [registercode], [registercodename], [requestdate], [doordate], [userreflect], [serviceattitude], [quality], [returnpeople], [returnname], [feedbacktime], [mydCode_NAME], [ZZDCode_Name], [feedback], [codeCode_Name]) SELECT distinct t1.RELATION_ID ,t1.workorderid ,t1.usercode ,t1.linkname  ,t1.userphone  ,t1.username  ,t1.usermobile  ,t1.keyword  ,ywly.Code_Name ,mglx.Code_Name  ,ga.Area_desc  ,t1.rangecodedepart  ,t1.organization  ,t1.wateraddress  ,t1.street  ,t1.problemdescription  ,t1.opinion  ,(CASE t1.isnoresolve WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.emergencyrepair WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isovertime WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isdoortodoor WHEN '0' THEN '否' ELSE '是' END ),t1.datelimit ,t1.rangecodemobile ,(CASE t1.isvalidity WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isautoreturnvisit WHEN '0' THEN '否' ELSE '是' END ) ,t1.staffid ,t1.staffname ,t1.registrant ,t1.registrantname ,t1.registerdate ,t1.ordertime ,t1.workorderreceiver ,t1.receivername ,c1.Code_Name ,c2.Code_Name ,c3.Code_Name ,t1.leakagecondition ,t1.handledescription ,t1.remarks ,t1.failurecause ,t1.starttime ,t1.finishtime ,t1.workingday ,t1.handlerby ,t1.handlername ,t1.handlerphone ,t1.responsibleperson ,t1.responsiblename ,t1.arriveddate,t1.firstarrivaldate ,t1.checkgrade ,t1.registercode ,t1.registercodename ,t1.requestdate ,t1.doordate ,(CASE t1.userreflect WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.serviceattitude WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.quality WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ),t1.returnpeople ,t1.returnname ,t1.feedbacktime ,myd.Code_NAME ,ZZD.Code_Name  ,t1.feedback ,code.Code_Name FROM  objective o LEFT JOIN WO3_FRAME_MAP fm on fm.map_id=o.map_id LEFT JOIN WO3_node_MAP nm on o.CURSTEP_ID_MAP=nm.nodemap_id and nm.MAP_ID=fm.map_id LEFT JOIN Customer  C ON o.Customer_GUID = C.Customer_GUID LEFT JOIN sysc_priority On o.Priority_id=sysc_priority.Priority_ID LEFT JOIN ROLEGROUP R1 ON R1.ROLEGROUP_ID=o.HandleGroup_ID LEFT JOIN STAFF S1 ON S1.STAFF_ID=o.HandleBy_ID LEFT JOIN STAFF S2 ON S2.STAFF_ID=o.ModifiedBy LEFT JOIN STAFFROLEGROUP SR ON SR.STAFF_ID=S1.STAFF_ID LEFT JOIN sysc_objectivestatus so on o.objectivestatus=so.objectivestatus LEFT JOIN role role on o.handlerole_id=role.role_id  LEFT JOIN TABCswgdmerge t1 on o.objective_guid=t1.relation_id left join C_CodeTables code on  t1.workorderstatus=code.Code_ID and use_type='工单状态' left join C_CodeTables c1 on  t1.registerbusiness1=c1.Code_ID and c1.use_type='一级业务类型' left join C_CodeTables c2 on  t1.registerbusiness2=c2.Code_ID and c2.use_type='二级业务类型' left join C_CodeTables c3 on  t1.registerbusiness3=c3.Code_ID and c3.use_type='三级业务类型' left join C_CodeTables cc on  t1.rangecodewater=cc.Code_ID and cc.use_type='受理部门' left join C_CodeTables ywly on  t1.operationsource=ywly.Code_ID and ywly.use_type='业务来源' left join C_CodeTables mglx on  t1.sensitive=mglx.Code_ID and mglx.use_type='敏感类型' left join C_CodeTables myd on  t1.satisfaction=myd.Code_ID and myd.use_type='满意度' left join C_CodeTables zzd on  t1.empattire=zzd.Code_ID and zzd.use_type='满意度' left join Group_Area ga on  t1.RECEIVER=ga.area_id where 1=1   and fm.map_id='ZHS14C' and t1.receiver='BA' and  t1.registerdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)  and  o.createddate>CONVERT(VARCHAR(10),GETDATE()-1,120) and  t1.registerdate<CONVERT(VARCHAR(10),GETDATE(),120)  and  o.createddate<CONVERT(VARCHAR(10),GETDATE(),120) order by  t1.registerdate desc ";
			eliteBean.update(todaysql_ins19, "dataSource");
			
			//--光明工单数据 
		    def todaysql_ins20 = "INSERT INTO [sw_gm_work] ([RELATION_ID], [workorderid], [usercode], [linkname], [userphone], [username], [usermobile], [keyword], [ywlyCode_Name], [mglxCode_Name], [Area_desc], [rangecodedepart], [organization], [wateraddress], [street], [problemdescription], [opinion], [isnoresolve], [emergencyrepair], [isovertime], [isdoortodoor], [datelimit], [rangecodemobile], [isvalidity], [isautoreturnvisit], [staffid], [staffname], [registrant], [registrantname], [registerdate], [ordertime], [workorderreceiver], [receivername], [c1Code_Name], [c2Code_Name], [c3Code_Name], [leakagecondition], [handledescription], [remarks], [failurecause], [starttime], [finishtime], [workingday], [handlerby], [handlername], [handlerphone], [responsibleperson], [responsiblename], [arriveddate], [firstarrivaldate], [checkgrade], [registercode], [registercodename], [requestdate], [doordate], [userreflect], [serviceattitude], [quality], [returnpeople], [returnname], [feedbacktime], [mydCode_NAME], [ZZDCode_Name], [feedback], [codeCode_Name]) SELECT distinct t1.RELATION_ID ,t1.workorderid ,t1.usercode ,t1.linkname  ,t1.userphone  ,t1.username  ,t1.usermobile  ,t1.keyword  ,ywly.Code_Name ,mglx.Code_Name  ,ga.Area_desc  ,t1.rangecodedepart  ,t1.organization  ,t1.wateraddress  ,t1.street  ,t1.problemdescription  ,t1.opinion  ,(CASE t1.isnoresolve WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.emergencyrepair WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isovertime WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isdoortodoor WHEN '0' THEN '否' ELSE '是' END ),t1.datelimit ,t1.rangecodemobile ,(CASE t1.isvalidity WHEN '0' THEN '否' ELSE '是' END ) ,(CASE t1.isautoreturnvisit WHEN '0' THEN '否' ELSE '是' END ) ,t1.staffid ,t1.staffname ,t1.registrant ,t1.registrantname ,t1.registerdate ,t1.ordertime ,t1.workorderreceiver ,t1.receivername ,c1.Code_Name ,c2.Code_Name ,c3.Code_Name ,t1.leakagecondition ,t1.handledescription ,t1.remarks ,t1.failurecause ,t1.starttime ,t1.finishtime ,t1.workingday ,t1.handlerby ,t1.handlername ,t1.handlerphone ,t1.responsibleperson ,t1.responsiblename ,t1.arriveddate,t1.firstarrivaldate ,t1.checkgrade ,t1.registercode ,t1.registercodename ,t1.requestdate ,t1.doordate ,(CASE t1.userreflect WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.serviceattitude WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ) ,(CASE t1.quality WHEN '1' THEN '满意' WHEN '2' THEN '一般' WHEN '3' THEN '不满意' WHEN '4' THEN '基本满意' WHEN '5' THEN'未表态' ELSE '' END ),t1.returnpeople ,t1.returnname ,t1.feedbacktime ,myd.Code_NAME ,ZZD.Code_Name  ,t1.feedback ,code.Code_Name FROM  objective o LEFT JOIN WO3_FRAME_MAP fm on fm.map_id=o.map_id LEFT JOIN WO3_node_MAP nm on o.CURSTEP_ID_MAP=nm.nodemap_id and nm.MAP_ID=fm.map_id LEFT JOIN Customer  C ON o.Customer_GUID = C.Customer_GUID LEFT JOIN sysc_priority On o.Priority_id=sysc_priority.Priority_ID LEFT JOIN ROLEGROUP R1 ON R1.ROLEGROUP_ID=o.HandleGroup_ID LEFT JOIN STAFF S1 ON S1.STAFF_ID=o.HandleBy_ID LEFT JOIN STAFF S2 ON S2.STAFF_ID=o.ModifiedBy LEFT JOIN STAFFROLEGROUP SR ON SR.STAFF_ID=S1.STAFF_ID LEFT JOIN sysc_objectivestatus so on o.objectivestatus=so.objectivestatus LEFT JOIN role role on o.handlerole_id=role.role_id  LEFT JOIN TABCswgdmerge t1 on o.objective_guid=t1.relation_id left join C_CodeTables code on  t1.workorderstatus=code.Code_ID and use_type='工单状态' left join C_CodeTables c1 on  t1.registerbusiness1=c1.Code_ID and c1.use_type='一级业务类型' left join C_CodeTables c2 on  t1.registerbusiness2=c2.Code_ID and c2.use_type='二级业务类型' left join C_CodeTables c3 on  t1.registerbusiness3=c3.Code_ID and c3.use_type='三级业务类型' left join C_CodeTables cc on  t1.rangecodewater=cc.Code_ID and cc.use_type='受理部门' left join C_CodeTables ywly on  t1.operationsource=ywly.Code_ID and ywly.use_type='业务来源' left join C_CodeTables mglx on  t1.sensitive=mglx.Code_ID and mglx.use_type='敏感类型' left join C_CodeTables myd on  t1.satisfaction=myd.Code_ID and myd.use_type='满意度' left join C_CodeTables zzd on  t1.empattire=zzd.Code_ID and zzd.use_type='满意度' left join Group_Area ga on  t1.RECEIVER=ga.area_id where 1=1   and fm.map_id='ZHS14C' and t1.receiver='GM' and  t1.registerdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)  and  o.createddate>CONVERT(VARCHAR(10),GETDATE()-1,120) and  t1.registerdate<CONVERT(VARCHAR(10),GETDATE(),120)  and  o.createddate<CONVERT(VARCHAR(10),GETDATE(),120) order by  t1.registerdate desc ";
			eliteBean.update(todaysql_ins20, "dataSource");
			
			
			//--宝安坐席信息列表
			def todaysql_ins21 = "INSERT INTO sw_ba_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0003','BAGLZ1','BASSZ1') AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins21, "dataSource");
			//--宝安单一通话信息 
		    def todaysql_ins22 = "INSERT INTO sw_ba_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.areatype='74BCB8CD-D886-7B4D-BE0E-AAECE71FA6DE' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins22, "dataSource");
			//--宝安核心数据 
		    def todaysql_ins23 = "INSERT INTO [sw_ba_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID]) select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID, a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0003','BAGLZ1','BASSZ1') AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins23, "dataSource");
			//--宝安来访公告记录 
		    def todaysql_ins24 = "INSERT INTO [sw_ba_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%宝安%' and CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins24, "dataSource");
			//--宝安录音记录
		    def todaysql_ins25 = "INSERT INTO [sw_ba_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID])select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID in('CW0003','BAGLZ1','BASSZ1') and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins25, "dataSource");
			//--宝安话务员档案 
		    def todaysql_ins26 = "INSERT INTO [sw_ba_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR]) select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP in('CW0003','BAGLZ1','BASSZ1') and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins26, "dataSource");
			//--宝安话务员登录信息 
		    def todaysql_ins27 = "INSERT INTO [sw_ba_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS]) select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup in('CW0003','BAGLZ1','BASSZ1') and  LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins7, "dataSource");
			//--宝安小结数据 
		    def todaysql_ins28 = "INSERT INTO [sw_ba_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) select createdate,phone,usercode,wateraddress,phonetype,phonetype1,phoneremark from TABCsummarize where region='宝安区' and createdate<CONVERT(VARCHAR(10),GETDATE(),120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins8, "dataSource");
			
			
			//--光明坐席信息列表
			def todaysql_ins29 = "INSERT INTO sw_gm_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0004','GMGLZU') AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins29, "dataSource");
			//--光明单一通话信息 
		    def todaysql_ins30 = "INSERT INTO sw_gm_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.areatype='ED48B3EA-347F-684F-99A3-9C0BA66B744F' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins30, "dataSource");
			//--光明核心数据 
		    def todaysql_ins31 = "INSERT INTO [sw_gm_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID]) select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID, a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0004','GMGLZU') AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins31, "dataSource");
			//--光明来访公告记录 
		    def todaysql_ins32 = "INSERT INTO [sw_gm_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%光明%' and CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins32, "dataSource");
			//--光明录音记录
		    def todaysql_ins33 = "INSERT INTO [sw_gm_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID])select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID in('CW0004','GMGLZU') and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins33, "dataSource");
			//--光明话务员档案 
		    def todaysql_ins34 = "INSERT INTO [sw_gm_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR]) select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP in('CW0004','GMGLZU') and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins34, "dataSource");
			//--光明话务员登录信息 
		    def todaysql_ins35 = "INSERT INTO [sw_gm_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS]) select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup in('CW0004','GMGLZU') and  LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins35, "dataSource");
			//--光明小结数据 
		    def todaysql_ins36 = "INSERT INTO [sw_gm_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) select createdate,phone,usercode,wateraddress,phonetype,phonetype1,phoneremark from TABCsummarize where region='光明区' and createdate<CONVERT(VARCHAR(10),GETDATE(),120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins36, "dataSource");
			
			
			
			//--集团坐席信息列表
			def todaysql_ins37 = "INSERT INTO sw_jt_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0001','GLZ001') AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins37, "dataSource");
			//--集团单一通话信息 
		    def todaysql_ins38 = "INSERT INTO sw_jt_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.areatype='475AE8F5-8C60-0947-96D6-D4999CE07DF4' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins38, "dataSource");
			//--集团核心数据 
		    def todaysql_ins39 = "INSERT INTO [sw_jt_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID]) select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID, a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID in('CW0001','GLZ001') AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins39, "dataSource");
			//--集团来访公告记录 
		    def todaysql_ins40 = "INSERT INTO [sw_jt_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%话务%' or RECEIVER LIKE '%管理%' and CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins40, "dataSource");
			//--集团录音记录
		    def todaysql_ins41 = "INSERT INTO [sw_jt_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID])select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID in('CW0001','GLZ001') and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins41, "dataSource");
			//--集团话务员档案 
		    def todaysql_ins42 = "INSERT INTO [sw_jt_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR]) select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP in('CW0001','GLZ001') and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins42, "dataSource");
			//--集团话务员登录信息 
		    def todaysql_ins43 = "INSERT INTO [sw_jt_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS]) select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup in('CW0001','GLZ001') and  LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins43, "dataSource");
			//--集团小结数据 
		    def todaysql_ins44 = "INSERT INTO [sw_jt_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) SELECT t.createdate,t.phone,t.usercode,t.wateraddress,t.phonetype,t.phonetype1,t.phoneremark FROM TABCsummarize t left join C_CodeTables c on c.Code_Name=t.region and c.use_type = '行政区域' WHERE c.Code_Desc = 'JT' and c.Code_Guid !='312AD6EE-A60D-4A2C-B386-B31AD279B8F1' and c.Code_Guid !='49165F3E-8F66-419D-A6C9-DEEC741B3714' AND createdate < CONVERT (VARCHAR(10), GETDATE(), 120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins44, "dataSource");
			
			
			
			//--坪地坐席信息列表
			def todaysql_ins45 = "INSERT INTO sw_pd_Agent_Status_Detail (REC_GUID,AGENTID,STARTTIME,ENDTIME,STATUS,WORKMODE,DEVICEDN,QUEUE,CALLTYPE,ANI,DNIS,VDN,REASONCODE) select a.REC_GUID,a.AGENTID,a.STARTTIME,a.ENDTIME,a.STATUS,a.WORKMODE,a.DEVICEDN,a.QUEUE,a.CALLTYPE,a.ANI,a.DNIS,a.VDN,a.REASONCODE from Agent_Status_Detail a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID  LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID ='PDSS01' AND a.StartTime<CONVERT(VARCHAR(10),GETDATE(),120) and a.StartTime>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins45, "dataSource");
			//--坪地单一通话信息 
		    def todaysql_ins46 = "INSERT INTO sw_pd_Call_Detail_View ([REC_GUID],[CALLTYPE],[CALLSTARTTIME],[CALLENDTIME],[CALLRESULT],[ANI],[DNIS],[FIRSTIVRPORT],[FIRSTIVRRINGINGSTARTTIME],[FIRSTIVRRINGINGENDTIME],[FIRSTIVRENDTIME],[FIRSTAGENTCDN],[FIRSTAGENTQUEUE],[FIRSTAGENTQUEUESTARTTIME],[FIRSTAGENTQUEUEENDTIME],[FIRSTAGENTQUEUEABANDONED],[FIRSTAGENT],[FIRSTDN],[FIRSTRINGINGSTARTTIME],[FIRSTRINGINGENDTIME],[FIRSTAGENTABANDONED]) select  c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.flowid='坪地流程' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120) UNION select  c.REC_GUID,c.CALLTYPE,c.CALLSTARTTIME,c.CALLENDTIME,c.CALLRESULT,c.ANI,c.DNIS,c.FIRSTIVRPORT,c.FIRSTIVRRINGINGSTARTTIME,c.FIRSTIVRRINGINGENDTIME,c.FIRSTIVRENDTIME,c.FIRSTAGENTCDN,c.FIRSTAGENTQUEUE,c.FIRSTAGENTQUEUESTARTTIME,c.FIRSTAGENTQUEUEENDTIME,c.FIRSTAGENTQUEUEABANDONED,c.FIRSTAGENT,c.FIRSTDN,c.FIRSTRINGINGSTARTTIME,c.FIRSTRINGINGENDTIME,c.FIRSTAGENTABANDONED from Call_Detail_View c LEFT JOIN szwg_ivr_keyinfo_viewdesc s on c.ucid=s.recguid where c.Calltype=1 and s.rk=1 and s.flowid='转接'and s.nodeid='PD' and  c.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and c.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins46, "dataSource");
			//--坪地核心数据 
		    def todaysql_ins47 = "INSERT INTO [sw_pd_EVENT] ([EVENT_GUID],[CALLTYPE],[CUSTOMER_GUID],[DNIS],[ANI],[CALLSTARTTIME],[CALLENDTIME],[WORKSTARTTIME],[WORKENDTIME],[HANDLEBY_ID],[HANDLEGROUP_ID],[CALLBEGINTIME],[CALLESTABLISHED],[RECORD_GUID],[EXTENSION],[AGENTID])select a.EVENT_GUID,a.CALLTYPE,a.CUSTOMER_GUID,a.DNIS,a.ANI,a.CALLSTARTTIME,a.CALLENDTIME,a.WORKSTARTTIME,a.WORKENDTIME,a.HANDLEBY_ID,a.HANDLEGROUP_ID,a.CALLBEGINTIME,a.CALLESTABLISHED,a.RECORD_GUID,a.Extension,a.AGENTID from EVENT a LEFT JOIN  staff s on a.AgentID=s.AGENT_ID LEFT JOIN ROLEGROUP r on s.DEFAULTROLEGROUP=r.ROLEGROUP_ID LEFT JOIN RolegroupArea ro on r.ROLEGROUP_ID = ro.Group_id LEFT JOIN Group_Area g on ro.Area_guid = g.Area_guid WHERE r.ROLEGROUP_ID ='PDSS01' AND a.CALLSTARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and a.CALLSTARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins47, "dataSource");
			//--坪地来访公告记录 
		    def todaysql_ins48 = "INSERT INTO [sw_pd_MSG_NOTICE] ([STARTTIME], [ENDTIME], [REPORTER], [TITIL], [CONTNECT], [REMARK], [REDACTTIME]) select CREATEDTIME,DEPRECATEDTIME,CREATEDBY,SUBJECT,SUBJECT,SUBJECT,CREATEDTIME from MSG_NOTICE where RECEIVER LIKE '%坪地%' and  CREATEDTIME<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins48, "dataSource");
			//--坪地录音记录
		    def todaysql_ins49 = "INSERT INTO [sw_pd_RECORD] ([RECORD_GUID],[DNIS],[ANI],[STARTTIME],[ENDTIME],[STAFF_ID],[AGENT_ID],[EXTENSION],[CALLTYPE],[DOCUMENTPATH],[HANGUPTYPE],[CUSTOMER_GUID],[CUSTOMERNAME],[ROLEGROUP_ID]) select RECORD_GUID,DNIS,ANI,STARTTIME,ENDTIME,STAFF_ID,AGENT_ID,EXTENSION,CALLTYPE,HANGUPTYPE,DOCUMENTPATH,CUSTOMER_GUID,CUSTOMERNAME,ROLEGROUP_ID from RECORD where Rolegroup_ID ='PDSS01'  and STARTTIME<CONVERT(VARCHAR(10),GETDATE(),120) and STARTTIME>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins49, "dataSource");
			//--坪地话务员档案 
		    def todaysql_ins50 = "INSERT INTO [sw_pd_STAFF] ([STAFF_ID],[AGENT_ID],[STAFFNAME],[DEFAULTROLEGROUP],[WORKSTATUS],[CREATEDBY],[CREATEDDATE],[MODIFIEDBY],[MODIFIEDDATE],[PASSWORD],[LOGINNAME],[ISSUPERVISOR])select STAFF_ID,AGENT_ID,STAFFNAME,DEFAULTROLEGROUP,WORKSTATUS,CREATEDBY,CREATEDDATE,MODIFIEDBY,MODIFIEDDATE,PASSWORD,LOGINNAME,ISSUPERVISOR from staff where DEFAULTROLEGROUP ='PDSS01'  and  CREATEDDATE<CONVERT(VARCHAR(10),GETDATE(),120) and CREATEDDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins50, "dataSource");
			//--坪地话务员登录信息 
		    def todaysql_ins51 = "INSERT INTO [sw_pd_T_logintablehis] ([LOGIN_GUID],[ROLEGROUP_ID],[AGENT_ID],[STAFF_ID],[LOGINTIME],[LOGOUTTIME],[LOGOUTBY],[ONLINESTATUS])select t.loginUUID,t.LoginGroup,t.StaffID,s.AGENT_ID,t.LOGINDATE,t.LogoutDate,t.StaffID,t.LogoutType from  T_logintablehis t left join staff s on t.StaffID=s.staff_id where LoginGroup ='PDSS01'  and LOGINDATE<CONVERT(VARCHAR(10),GETDATE(),120) and LOGINDATE>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins51, "dataSource");
			//--坪地小结数据 
		    def todaysql_ins52 = "INSERT INTO [sw_pd_TABCsummarize] ([CALLTIME],[CALLNO],[USERCODE],[WATER_ADDRESS],[REFLECTION_TYPEDESC],[REFLECTING_CONTENT],[REMARK]) select createdate,phone,usercode,wateraddress,phonetype,phonetype1,phoneremark from TABCsummarize where region='坪地' and createdate<CONVERT(VARCHAR(10),GETDATE(),120) and createdate>=CONVERT(VARCHAR(10),GETDATE()-1,120)";
			eliteBean.update(todaysql_ins52, "dataSource");

			
			resulterror.put("code", "1");
			resulterror.put("msg", "数据分离每天定时插入数据完成");
			return  resulterror;
			
		}catch(Exception e){
			resulterror.put("code", "-1");
			resulterror.put("msg", "接口异常！"+e);
			return  resulterror;
		}
	}
}